from rsa_face.RSA import RSA
import cv2
import numpy as np

if __name__ == '__main__':
    detector = RSA()
    img = cv2.imread('rsa_face/testimg2.jpg')
    bboxes, pts = detector.detect(img)
    bboxes = bboxes.astype(np.int)
    pts = pts.astype(np.int)
    for i in range(bboxes.shape[0]):
        color = (np.random.randint(0, 256),np.random.randint(0, 256),np.random.randint(0, 256))
        cv2.rectangle(img,(bboxes[i][0],bboxes[i][1]),(bboxes[i][2],bboxes[i][3]),color,3)
        pt = pts[i].reshape(-1, 2)
        for j in range(pt.shape[0]):
            cv2.circle(img, (pt[j,0],pt[j,1]) , 3, color)
    
    cv2.imwrite('rsa.jpg', img)

    # cv2.imshow('test', img)
    # cv2.waitKey()